<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>页面</title>
</head>
<body>
<div>该吃饭了!</div>
<input type="text" id="i1">
<input type="button" value="按钮" onclick="f()">
 <script>
     function f() {
         //得到文本框和div对象
         let i = document.querySelector("#i1");
         let d = document.querySelector("div");
         //把文本框的值给到div
         d.innerText = i.value;
     }
     //let d = document.querySelector("div")
     //d.innerText;
     //d.innerText = "饿死了";
 </script>
</body>
</html>